
//接收一个数组和要查找的值，返回对应下标，没有则返回-1
function sequentSearch(array:number[],num:number){
    for(let i = 0; i<array.length;i++){
        const item = array[i];
        if(item === num){
            return i
        }
    }
    return -1
}

const index = sequentSearch([1,2,3,4,5,6,7,8],7)
console.log(index)

export default sequentSearch;